package com.riche.aicodehelper.ai;

import com.riche.aicodehelper.ai.guardrail.SafeInputGuardrail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * @InterfaceName: AiCodeHelperService
 * @Description: ai服务接口
 * @Author: Gaoruiqi
 * @Date: 2025-09-25 16:51
 * @Version: 1.0
 **/
@InputGuardrails({SafeInputGuardrail.class})
public interface AiCodeHelperService {

    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(@MemoryId int memoryId, String userMessage);

    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(String userMessage);

    @SystemMessage(fromResource = "system-prompt.txt")
    Report chatForReport(String userMessage);

    // 利用Java 14 的 record 语法定义一个数据结构
    record Report(String name, List<String> suggestionList){};

    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);

    @SystemMessage(fromResource = "system-prompt.txt")  // 添加系统提示
    Flux<String> chatWithStream(@MemoryId int memoryId, @UserMessage String message);


}
